package cn.edu.hunau.pm.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class HelloAction {
    //@RequestMapping(path="/hello",method= RequestMethod.GET)
    @GetMapping("/hello")//同理，还有postmapping
    public String helloMethod()//处理hello这个请求
    {
        System.out.println("Hello,SpringBoot");
        return "login";
    }

    @GetMapping("/display")//同理，还有Postmapping
    public String displayMethod()
    {
        System.out.println("Hello,SpringBoot/display");
        return "display";
    }

    @GetMapping("/hi")//重定向
    public String hiMethod()
    {
        System.out.println("Hi,SpringBoot");
        return "redirect:login.html";
    }

    @GetMapping("/show")//重定向到一个请求
    public String showMethod()
    {
        System.out.println("show,SpringBoot");
        return "redirect:/hello";
    }
}
